﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Details.aspx.cs" Inherits="Pages_Details"
    MasterPageFile="~/Admin/ManagerPage.master" Title="新闻发布" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="C">
    <div class="toolbar">
        <XCL:LinkBox ID="lbAdd" runat="server" BoxHeight="595px" BoxWidth="910px" Url="DetailsForm.aspx"
            IconLeft="~/Admin/images/icons/new.gif"><b>添加</b></XCL:LinkBox>
        关键字：<asp:TextBox ID="txtKey" runat="server"></asp:TextBox>
        <asp:Button ID="btnSearch" runat="server" Text="查询" />
    </div>
    <asp:GridView ID="gvDetails" runat="server" AutoGenerateColumns="False" DataKeyNames="ID"
        DataSourceID="odsDetails" AllowPaging="True" AllowSorting="True" CssClass="m_table"
        PageSize="18" CellPadding="0" GridLines="None" EnableModelValidation="True">
        <Columns>
            <asp:BoundField DataField="ID" HeaderText="编号" SortExpression="ID" InsertVisible="False"
                ReadOnly="True" />
            <%--<asp:BoundField DataField="Classis" HeaderText="分类" SortExpression="Classis" />--%>
            <asp:TemplateField HeaderText="分类" SortExpression="ClassisID">
                    <ItemTemplate>
                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("Classis.Name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            <%--<asp:BoundField DataField="UserID" HeaderText="用户名" SortExpression="UserID" />--%>
            <asp:TemplateField HeaderText="用户名" SortExpression="UserID">
                    <ItemTemplate>
                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("Admin1.Name") %>'></asp:Label>
                    </ItemTemplate>
                </asp:TemplateField>
            <asp:BoundField DataField="Title" HeaderText="新闻标题" SortExpression="Title" />
            <asp:BoundField DataField="CreateTime" HeaderText="创建时间" SortExpression="CreateTime"
                DataFormatString="{0:yyyy-MM-dd HH:mm:ss}">
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px" />
            </asp:BoundField>
            <asp:BoundField DataField="EditTime" HeaderText="编辑时间" SortExpression="EditTime"
                DataFormatString="{0:yyyy-MM-dd HH:mm:ss}">
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="120px" />
            </asp:BoundField>
            <asp:BoundField DataField="Hits" HeaderText="点击数" SortExpression="Hits" />
            <XCL:LinkBoxField HeaderText="编辑" DataNavigateUrlFields="ID" DataNavigateUrlFormatString="DetailsForm.aspx?ID={0}"
                Height="595px" Text="编辑" Width="910px" Title="编辑">
                <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
            </XCL:LinkBoxField>
            <asp:TemplateField ShowHeader="False" HeaderText="删除">
                <ItemTemplate>
                    <asp:LinkButton ID="btnDelete" runat="server" CausesValidation="False" CommandName="Delete"
                        OnClientClick='return confirm("确定删除吗？")' Text="删除"></asp:LinkButton>
                </ItemTemplate>
                <HeaderStyle HorizontalAlign="Center" VerticalAlign="Middle" Width="30px" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            没有符合条件的数据！
        </EmptyDataTemplate>
    </asp:GridView>
    <asp:ObjectDataSource ID="odsDetails" runat="server" DataObjectTypeName="NewsPub.Details"
        DeleteMethod="Delete" EnablePaging="True" OldValuesParameterFormatString="original_{0}"
        SelectCountMethod="SearchCount" SelectMethod="Search" SortParameterName="orderClause"
        TypeName="NewsPub.Details">
        <SelectParameters>
            <asp:ControlParameter ControlID="txtKey" Name="key" PropertyName="Text" Type="String" />
            <asp:Parameter Name="orderClause" Type="String" DefaultValue="CreateTime desc" />
            <asp:Parameter Name="startRowIndex" Type="Int32" />
            <asp:Parameter Name="maximumRows" Type="Int32" />
        </SelectParameters>
    </asp:ObjectDataSource>
    <XCL:GridViewExtender ID="gvExt" runat="server">
    </XCL:GridViewExtender>
</asp:Content>
